package com.jkl.nettyserver.Config;

import io.netty.channel.nio.NioEventLoopGroup;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.net.InetSocketAddress;

@Data
@Configuration
@ConfigurationProperties(prefix = "netty")
public class NettyConfig {
    private Integer boss;//boss线程数量
    private Integer worker;//worker线程数量
    private Integer timeout;//连接超时时间
    private Integer port;//服务器主端口
    public NioEventLoopGroup bossGroup() {//boss线程池-进行客户端连接
        return new NioEventLoopGroup(boss);
    }
    public NioEventLoopGroup workerGroup() {//worker线程池-进行业务处理
        return new NioEventLoopGroup(worker);
    }
}